/**
 * Created by yanweiqiang on 2016/6/24 0024.
 */
function SocketMgr() {
    this.socketIds = [];

    this.put = function (chatId, socketId) {
        this.socketIds[chatId] = socketId;
    };

    this.get = function (chatId) {
        return this.socketIds[chatId];
    };

    this.emit = function (sockets, chatId, type, data) {
        var socketId = this.get(chatId);

        if (socketId) {
            sockets[socketId].emit(type, data);
        } else {
            console.log("对方不在线");
        }
    }
}
module.exports = SocketMgr;